﻿<UserControl x:Class="SoftTeach.View.Stundenpläne.StundenplanWorkspaceView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:SoftTeach="clr-namespace:SoftTeach"
             xmlns:Globalization="clr-namespace:System.Globalization;assembly=mscorlib"
             xmlns:StundenplanViewModel="clr-namespace:SoftTeach.ViewModel.Stundenpläne"
             xmlns:StundenplanView="clr-namespace:SoftTeach.View.Stundenpläne" mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="800"
             Background="{StaticResource DefaultOfficeBackgroundBrush}">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="250"/>
      <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0">
      <GroupBox Grid.Row="1" Padding="5" Header="Stundenpläne" Margin="5"
                HeaderTemplate="{StaticResource GroupBoxHeader}">
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
          </Grid.RowDefinitions>
          <StackPanel Grid.Row="0" Orientation="Horizontal">
            <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"  Visibility="Collapsed" Command="{Binding Path=AddStundenplanCommand}" ToolTip="Neuen Stundenplan erstellen">
              <StackPanel Orientation="Horizontal">
                <Grid>
                  <Image Source="/SoftTeach;component/Images/Schultermin32.png"/>
                  <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
                </Grid>
                <Label Padding="5,0,0,0" VerticalContentAlignment="Center">Neuen Stundenplan erstellen</Label>
              </StackPanel>
            </Button>
            <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Visibility="Collapsed" Command="{Binding Path=EditStundenplanCommand}" ToolTip="Wenn im Halbjahr neue Stundenpläne gültig werden, bitte hier die Stundenplanänderungen eingeben.">
              <StackPanel Orientation="Horizontal">
                <Grid>
                  <Image Source="/SoftTeach;component/Images/Schultermin32.png"/>
                  <Image Source="/SoftTeach;component/Images/EditOverlay32.png"/>
                </Grid>
                <Label Padding="5,0,0,0" VerticalContentAlignment="Center">Stundenplanänderung eingeben</Label>
              </StackPanel>
            </Button>
            <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=DeleteStundenplanCommand}" ToolTip="Stundenplan löschen" >
              <StackPanel Orientation="Horizontal">
                <Grid>
                  <Image Source="/SoftTeach;component/Images/Schultermin16.png" />
                  <Image Source="/SoftTeach;component/Images/RemoveOverlay16.png"/>
                </Grid>
                <Label Padding="5,0,0,0" VerticalContentAlignment="Center">Diesen Stundenplan löschen</Label>
              </StackPanel>
            </Button>
          </StackPanel>

          <DataGrid Grid.Row="1" Background="Transparent" SelectedItem="{Binding Path=CurrentStundenplan, Mode=TwoWay}" ItemsSource="{Binding Source={x:Static SoftTeach:App.MainViewModel}, Path=Stundenpläne}" AutoGenerateColumns="False" IsReadOnly="True">
            <DataGrid.Columns>
              <DataGridTextColumn Header="Halbjahr" 
                                  Binding="{Binding Path=StundenplanHalbjahrtyp.HalbjahrtypBezeichnung}" 
                                  SortMemberPath="StundenplanHalbjahrtyp.HalbjahrtypBezeichnung" Width="Auto"/>
              <DataGridTextColumn Header="Schuljahr" Binding="{Binding Path=StundenplanJahrtyp.JahrtypBezeichnung}" Width="Auto"/>
              <DataGridTextColumn Header="Gültig ab" Binding="{Binding Path=StundenplanGültigAb, StringFormat={}{0:dd.MM.yy},ConverterCulture={x:Static Globalization:CultureInfo.CurrentCulture}}" Width="*"/>
              <!--<DataGridTextColumn Header="Beschreibung" Binding="{Binding Path=StundenplanBezeichnung}" Width="*"/>-->
              <!--<DataGridTemplateColumn CanUserReorder="False" IsReadOnly="False">
                <DataGridTemplateColumn.CellTemplate>
                  <DataTemplate>
                    <Button Command="{Binding Path=DeleteStundenplanCommand}">
                      <Grid>
                        <Image Source="/SoftTeach;component/Images/Stundenplan16.png" />
                        <Image Source="/SoftTeach;component/Images/RemoveOverlay16.png"/>
                      </Grid>
                    </Button>
                  </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
              </DataGridTemplateColumn>-->
            </DataGrid.Columns>
          </DataGrid>
        </Grid>
      </GroupBox>
    </Grid>
    <ContentControl Grid.Column="1" Content="{Binding Path=CurrentStundenplan}">
      <ContentControl.Resources>
        <DataTemplate DataType="{x:Type StundenplanViewModel:StundenplanViewModel}">
          <StundenplanView:StundenplanDetailView />
        </DataTemplate>
      </ContentControl.Resources>
    </ContentControl>
  </Grid>
</UserControl>
